package cn.dlc.com.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 邓立川
 * @date 2021/11/21 10:02
 * @desc springmvc的核心配置
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 默认打开login(使用springsecurity的登录)
        // registry.addRedirectViewController("/","login");
        // 使用自己的登录
        registry.addRedirectViewController("/","/my-login");
        registry.addViewController("/my-login").setViewName("login");
    }
}
